﻿--Example Script only
--Here as a placeholder only

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Script](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[Fund] [varchar](10) NOT NULL,
	[ShortDescription] [varchar](50) NOT NULL,
	
 CONSTRAINT [PK_Script] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ScriptRevision](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[AuthorID] [int] NOT NULL,
	[ScriptID] [int] NOT NULL,
	[LongDescription] [varchar](200) NOT NULL,
	[Date] [DateTime] NOT NULL,
	[Version] [varchar](10) NOT NULL,
	[DBVersion] [varchar](10) NULL,
	[Text] [text] NULL,

 CONSTRAINT [PK_ScriptRevision] PRIMARY KEY CLUSTERED 
(
	[ID], [Version] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Author](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[FirstName] [varchar](40) NOT NULL,
	[LastName] [Varchar](40) NOT NULL,
 CONSTRAINT [PK_Author] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET ANSI_NULLS ON
GO

ALTER TABLE [dbo].[ScriptRevision]  WITH CHECK ADD  CONSTRAINT [FK_ScriptRevision_Script] FOREIGN KEY([ScriptID])
REFERENCES [dbo].[Script] ([ID])
GO
ALTER TABLE [dbo].[ScriptRevision] CHECK CONSTRAINT [FK_ScriptRevision_Script]
GO
ALTER TABLE [dbo].[ScriptRevision]  WITH CHECK ADD  CONSTRAINT [FK_ScriptRevision_Author] FOREIGN KEY([AuthorID])
REFERENCES [dbo].[Author] ([ID])
GO
ALTER TABLE [dbo].[ScriptRevision] CHECK CONSTRAINT [FK_ScriptRevision_Author]
GO

